package com.zeng.ssm.service.support.aspect;

import com.zeng.ssm.util.JsonUtil;
import org.aspectj.lang.ProceedingJoinPoint;

/**
 * 审计日志切面
 *
 * @author zengwanlin
 * @date 2022-01-27T12:26
 */
public class AuditLogAspect {


    /**
     * @param joinPoint
     * @return
     * @throws Throwable
     */
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        Object[] args = joinPoint.getArgs();

        String requestMsg = JsonUtil.toJson(args);
        System.out.println("请求参数：" + requestMsg);

        Object resultObject = joinPoint.proceed();

        String responseMsg = JsonUtil.toJson(resultObject);
        System.out.println("响应信息：" + responseMsg);

        return resultObject;
    }

}
